home *** CD-ROM | disk | FTP | other *** search
- (*
- ** -------------------------------------------------------------------------
- ** Program: Pathname
- ** Author: Keith R. Burby
- ** Version: 0.0
- ** Date: 23.12.93
- ** Description:
- ** Extract path name from full path/file name.
- ** -------------------------------------------------------------------------
- *)
-
- (*
- History:
-
- v0.0 (23.12.93)
- First Edition
- *)
-
- MODULE Pathname;
-
- IMPORT
- (* NoGuru, *)
- s := Strings,
- d := Dos;
-
- CONST
- PrgName = "Pathname\o"
- "$VER: Pathname 0.0 (23.12.93) Keith R. Burby";
-
- DosLibVer = 36;
- ArgTemplate = "NAME/A";
-
- TYPE
- ArgArray = STRUCT (dummy: d.ArgsStruct)
- Name: d.ArgString;
- END;
-
- VAR
- ErrNum: LONGINT;
-
-
- PROCEDURE GetPathname(): LONGINT;
-
- VAR
- MyArgs: ArgArray;
- PathAdr: d.ArgString;
- MyRDArgs: d.RDArgsPtr;
-
- BEGIN
- MyRDArgs := d.ReadArgs(ArgTemplate, MyArgs, NIL);
- IF (MyRDArgs # NIL) THEN
- PathAdr := d.PathPart(MyArgs.Name^);
- PathAdr[0] := "\o";
- d.PrintF("%s\n", MyArgs.Name);
- d.FreeArgs(MyRDArgs);
- END;
- RETURN(d.IoErr());
- END GetPathname;
-
-
- BEGIN
- IF (d.dos.lib.version >= DosLibVer) THEN
- ErrNum := GetPathname();
- IF (ErrNum # 0) THEN
- IF (d.PrintFault(ErrNum, PrgName)) THEN
- HALT(10);
- ELSE
- HALT(20);
- END;
- END;
- ELSE
- HALT(DosLibVer);
- END;
- END Pathname.
-